package com.example.demo.service.impl;

import com.example.demo.dao.ShopRepository;
import com.example.demo.model.entity.ScoreModel;
import com.example.demo.model.entity.ShopModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ShopService {

    @Resource
    ShopRepository shopRepository;

    public ShopModel save(ShopModel model) {
        return shopRepository.save(model);
    }


    public ShopModel getByShopId(String shopId) {
        return shopRepository.findOne(shopId);
    }

    public Page<ShopModel> getShopPage(Specification specification, Pageable pageable) {
        return shopRepository.findAll(specification, pageable);
    }

    public void delete(String shopId) {
        shopRepository.delete(shopId);
    }
}
